package com.xjoyt.pay.master.dao.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;

import com.xjoyt.pay.abstracts.AbstractDao;
import com.xjoyt.pay.master.dao.DistributorRateRepositoryCustom;
import com.xjoyt.pay.master.po.DistributorRate;
import com.xjoyt.pay.master.repository.DistributorRateRepository;
import com.xjoyt.pay.vo.PayType;

public class DistributorRateRepositoryImpl extends AbstractDao implements DistributorRateRepositoryCustom {

	@Autowired
	private DistributorRateRepository repository;

	@Override
	public DistributorRate findOneByDistributorIdAndType(String distributorId, PayType type) {
		Page<DistributorRate> page = repository.findAllByDistributorIdAndType(distributorId, type, getFirstPageable());
		return page.hasContent() ? page.iterator().next() : null;
	}

}
